<%--
  Created by IntelliJ IDEA.
  User: Darly
  Date: 2017/10/11
  Time: 17:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="root" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <!--標題欄圖標-->
    <link rel="SHORTCUT ICON" href="${root}/images/logo.ico"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>${itmsname}</title>
    <!-- 引入 Bootstrap -->
    <link href="${root}/vpm/bootstrap/ace/css/bootstrap.min.css" rel="stylesheet">
    <link href="${root}/vpm/bootstrap/ace/css/site.min.css" rel="stylesheet">
    <!-- HTML5 Shim 和 Respond.js 用于让 IE8 支持 HTML5元素和媒体查询 -->
    <!-- 注意： 如果通过 file://  引入 Respond.js 文件，则该文件无法起效果 -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="container tag-body">
    <div class="table-responsive">
        <table class="table table-striped table-bordered">
            <tbody>
            <c:forEach items="${Amuse}" var="item">
                <tr>
                    <td>
                        <div>
                            <img style="width: 45px;height: 45px" src="${item.user.icon}">
                            <span>${item.user.name}</span>
                            <label style="float: right" dart='${item.updatetime}'></label>
                        </div>
                        <div>
                            <h3>${item.title}</h3>
                        </div>
                        <div>
                            ${item.content}
                        </div>
                        <div>
                            <span style="font-size: small">浏览${item.watch}—评论${item.comment}</span>
                        </div>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</div>

<script>
    //格林威治时间的转换
    Date.prototype.format = function(format)
    {
        var o = {
            "M+" : this.getMonth()+1, //month
            "d+" : this.getDate(), //day
            "h+" : this.getHours(), //hour
            "m+" : this.getMinutes(), //minute
            "s+" : this.getSeconds(), //second
            "q+" : Math.floor((this.getMonth()+3)/3), //quarter
            "S" : this.getMilliseconds() //millisecond
        }
        if(/(y+)/.test(format))
            format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
        for(var k in o)
            if(new RegExp("("+ k +")").test(format))
                format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
        return format;
    }
    function chGMT(list) {
        for (var a = 0; a < list.length; a++) {
            var time = list[a].getAttribute("dart")
            var mydate = new Date(time + " GMT+0800");
            list[a].innerHTML = mydate.format("yyyy-MM-dd hh:mm:ss");
        }
    }
    chGMT(document.querySelectorAll('label'));
</script>

</body>
</html>